<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="<%=path%>/bootstrap-3.3.7/css/bootstrap-theme.css" />
<link rel="stylesheet" href="<%=path%>/bootstrap-3.3.7/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/css/style.css" />
<script type="text/javascript" src="<%=path %>/js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="<%=path%>/bootstrap-3.3.7/js/bootstrap.min.js"></script>

</head>
<body>
	<table id="rounded-corner">
    <thead>
    	<tr>
        	<th scope="col" class="rounded-company"></th>
            <th scope="col" class="rounded">景区名</th>
            <th scope="col" class="rounded">景区类型</th>
            <th scope="col" class="rounded">景区地址</th>
            <th scope="col" class="rounded">特色景点</th>
            <th scope="col" class="rounded">景区介绍信息</th>
            <th scope="col" class="rounded">景区状态</th>
            <th scope="col" class="rounded">联系人姓名</th>
            <th scope="col" class="rounded">联系人电话</th>
            <th scope="col" class="rounded">创建时间</th>
            <th scope="col" class="rounded">修改时间</th>
            <th scope="col" class="rounded">编辑</th>
            <th scope="col" class="rounded">开启/关闭</th>
        </tr>
    </thead>
    <tbody>
    	<tr>
    	<c:forEach items="${slist}" var="s">
        	<td><input type="checkbox" name="" /></td>
            <td>${s.name}</td>
            <td>${s.scenic_type}</td>
            <td>${s.address}</td>
            <td>${s.special_scenic}</td>
            <td>${s.introduce}</td>
            <td>${s.condition==1?'开启中':'已关闭'}</td>
            <td>${s.relation_name}</td>
            <td>${s.relation_tel}</td>
            <td>${s.create_time}</td>
            <td>${s.alert_time}</td>
            <td><input type="button" value="修改" class="btn btn-success" onclick="updjinqu(${s.id})"></td>
            <td>
            	<c:if test="${s.condition==1}">
            		<button type="button" class="btn btn-warning" onclick="closejinqu(${s.id})">关闭景区</button>
            	</c:if>
            	<c:if test="${s.condition==0}">
            		<button type="button" class="btn btn-success" onclick="open(${s.id})">开启景区</button>
            	</c:if>
            </td>            
    	</c:forEach>
       </tr>
    </tbody>
</table>
<center>
<button type="button" class="btn btn-success" style="width:100px;margin-right: 10px" onclick="addjinqu()">添加</button>
<button type="button" class="btn btn-danger" style="width:100px;" onclick="deljinqu()">删除</button>
</center>
</body>
<script type="text/javascript">
$(function(){
});
	function closejinqu(id){
 		alert(id);
		 $.ajax({
				url:"/travel/htmlcon/closejinqu",
				type:"post",
				data:{id:id},
				success:function(data){
					if(data){
						alert("关闭成功");
						location.href="/travel/htmlcon/sceniclist";
					}else{
						alert("关闭失败");
					}
				},dataType:"json"
				
			})
		/* 	
		 $.post(
			"/travel/htmlcon/closejinqu",
			{id:id},
			function(data){
				if(data){
					alert("关闭成功");
					location.reload();
				}else{
					alert("关闭失败");
				}
			},
			"json"
		); */
		
	}
	function updjinqu(id){
		location.href="/travel/htmlcon/updjinqu?id="+id;
	}
</script>		
</html>